package handler;

import handler.ClientStart;
import handler.task.ClientConnectTask;

import java.util.concurrent.*;

/**
 * @author dfj@99chuxing.com
 * @date 2018/4/4 0004 15:41
 * 使用线程池创建多个Client链接，测试并发情况下司机端Socket内存上升情况
 *
 */
public class ThreadPollByCilent {

    private static ThreadFactory namedThreadFactory = new ThreadFactory() {
        @Override
        public Thread newThread(Runnable r) {
            return new Thread(r,"thread_pool_" + r.hashCode());
        }
    };

    private  static  ThreadPoolExecutor threadPoolExecutor=new ThreadPoolExecutor(100,105,1000, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>(200),namedThreadFactory);

    public static void main(String[] args) {

        for (int i=0;i<100;i++){
            ClientConnectTask clientConnectTask = new ClientConnectTask(new ClientStart());
            threadPoolExecutor.execute(clientConnectTask);
        }


    }










}
